<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<!-- 下拉框 -->
<link rel="stylesheet" href="static/ace/css/chosen.css" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<title>出口过管理</title>
<meta name="description" content="" />
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

<link rel="stylesheet" href="static/ace/css/bootstrap.css" />
<link rel="stylesheet" href="static/ace/css/font-awesome.css" />

<!-- text fonts -->
<link rel="stylesheet" href="static/ace/css/ace-fonts.css" />
<!-- ace styles -->
<link rel="stylesheet" href="static/ace/css/ace.css"
	class="ace-main-stylesheet" id="main-ace-style" />
<script type="text/javascript" src="static/js/jquery-1.7.2.js" /></script>
<script type="text/javascript">
			$(top.hangge());
		</script>
<!--提示框-->
<script type="text/javascript" src="static/js/jquery.tips.js"></script>
</head>
<body class="no-skin">
	<div class="main-container" id="main-container">
		<div class="main-content">
			<div class="main-content-inner">
				<div class="page-content">
					<div class="row">
						<div class="col-xs-12">
							<form method="post" id="shipownerForm">
								<fieldset>
									<table style="margin-top: 5px;"
										class="table table-striped table-bordered table-hover">
										<tr>
											<td style="width:80px; text-align: right; padding-top: 13px;">快速检索码:</td>
											<td><input type="text" name="FAST_SEARCH_CODE" id="FAST_SEARCH_CODE" placeholder="这里输入快速检索码" title="快速检索码" maxlength="32" style="width: 98%;" /></td>
                                            <td style="width:80px; text-align: right; padding-top: 13px;">出口国代码:</td>
											<td><input type="text" name="EXPORT_COUNTRY_CODE" id="EXPORT_COUNTRY_CODE" placeholder="这里输入出口国代码" title="出口国代码" maxlength="32" style="width: 98%;" /></td>
											<td style="width:80px; text-align: right; padding-top: 13px;">英文名:</td>
											<td><input type="text" name="ENGLISH_NAME" id="ENGLISH_NAME" placeholder="这里输入英文名" title="英文名" maxlength="32" style="width: 98%;" /></td>
										 </tr>
										 <tr>	
											
									        <td style="width:80px; text-align: right; padding-top: 13px;">中文名:</td>
											<td><input type="text" name="CHINESE_NAME" id="CHINESE_NAME" placeholder="这里输入中文名" title="中文名" maxlength="32" style="width:98%;" /></td>
											<td style="width:80px; text-align: right; padding-top: 13px;">是否可用:</td>
											<td><select style="width:  98%;" name="ENABLE">
													<option value="">全部</option>
													<option value="1">是</option>
													<option value="0">否</option>
											</select></td>											
					                       <td style="text-align: left;" colspan="10">
											<a class="btn btn-xs btn-success"> 
											<i class="ace-icon fa fa-pencil-square-o bigger-120" onclick="add();">添加</i>
											</a></td>
										</tr>

										
									</table>
								</fieldset>
							</form>
							<form  method="post" id="shipoener">
								<fieldset>
									<table style="margin-top: 5px;"
										class="table table-striped table-bordered table-hover">
										<tr>
											<td style="width: 79px; text-align: right; padding-top: 13px;">英文名：</td>
											<td><input type="text"  name="ENGLISH_NAME" value="${pd.ENGLISH_NAME }" maxlength="32" style="width: 98%;" /></td>
											<td style="width: 79px; text-align: right; padding-top: 13px;">中文名：</td>
											<td><input type="text"  name="CHINESE_NAME" value="${pd.CHINESE_NAME }" maxlength="32" style="width: 98%;" /></td>
											<td style="width: 79px; text-align: right; padding-top: 13px;">检索码：</td>
											<td><input type="text"  name="FAST_SEARCH_CODE" value="${pd.FAST_SEARCH_CODE }" maxlength="32" style="width: 98%;" /></td>
											<td style="width: 79px; text-align: right; padding-top: 13px;">出口国代码：</td>
											<td><input type="text"  name="EXPORT_COUNTRY_CODE" value="${pd.EXPORT_COUNTRY_CODE }" maxlength="32" style="width: 98%;" /></td>
											<td style="text-align: left;" colspan="10"><a
												class="btn btn-xs btn-success"> <i
													class="ace-icon fa fa-pencil-square-o bigger-120"
													onclick="serch();">查询</i>
											</a></td>
										</tr>
									</table>
								</fieldset>
							</form>
					<table id="simple-table" class="table table-striped table-bordered table-hover" style="margin-top:5px;">
								<thead>
									<tr>
										<th class="center">出口国代码</th>
										<th class="center">英文名称</th>
										<th class="center">中文名称</th>										
										<th class="center">是否可用</th>
										<th class="center">检索码</th>
										<th class="center">修改</th>
										<th class="center">删除</th>
									</tr>
								</thead>
								<c:forEach items="${list}" var="export">
								   <tr>
										<td class="center">${export.EXPORT_COUNTRY_CODE}</td>
										<td class="center">${export.ENGLISH_NAME}</td>
										<td class='center'>${export.CHINESE_NAME}</td>
								 		<td class="center"><c:if test="${export.ENABLE ==1}">
        		                                                                                                                  是
                                         </c:if> <c:if test="${export.ENABLE ==0}">
        		                                                                                                                  否
        </c:if></td>
										
										<td class="center">${export.FAST_SEARCH_CODE}</td>
										
										<td class="center">
											<div class="hidden-sm hidden-xs btn-group">
												<a class="btn btn-xs btn-success"
													onclick="edit('${export.ID}');"> <i
													class="ace-icon fa fa-pencil-square-o bigger-120">修改</i>
												</a>
											</div>
										</td>
										<td class="center">
											<div class="hidden-sm hidden-xs btn-group">
												<a class="btn btn-xs btn-success"
													onclick="delet('${export.ID}');"> <i
													class="ace-icon fa fa-trash-o bigger-120">删除</i>
												</a>
											</div>
										</td>
                                     </tr>
									</c:forEach>
								
							</table>



						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
//新增
function add(){
	if($("#FAST_SEARCH_CODE").val()==""){
		$("#FAST_SEARCH_CODE").tips({
			side:3,
            msg:'请填写快速检索码',
            bg:'#AE81FF',
            time:2
        });
		$("#FAST_SEARCH_CODE").focus();
		$("#FAST_SEARCH_CODE").val('');
		$("#FAST_SEARCH_CODE").css("background-color","white");
		return false;
	}
	if($("#EXPORT_COUNTRY_CODE").val()==""){
		$("#EXPORT_COUNTRY_CODE").tips({
			side:3,
            msg:'请填写出口国代码',
            bg:'#AE81FF',
            time:2
        });
		$("#EXPORT_COUNTRY_CODE").focus();
		$("#EXPORT_COUNTRY_CODE").val('');
		$("#EXPORT_COUNTRY_CODE").css("background-color","white");
		return false;
	}
	if($("#ENGLISH_NAME").val()==""){
		$("#ENGLISH_NAME").tips({
			side:3,
            msg:'请填写英文名',
            bg:'#AE81FF',
            time:2
        });
		$("#ENGLISH_NAME").focus();
		$("#ENGLISH_NAME").val('');
		$("#ENGLISH_NAME").css("background-color","white");
		return false;
	}
	if($("#CHINESE_NAME").val()==""){
		$("#CHINESE_NAME").tips({
			side:3,
            msg:'请填写中文名',
            bg:'#AE81FF',
            time:2
        });
		$("#CHINESE_NAME").focus();
		$("#CHINESE_NAME").val('');
		$("#CHINESE_NAME").css("background-color","white");
		return false;
	}
	
	if($("#ENABLE").val()==""){
		$("#ENABLE").tips({
			side:3,
            msg:'请填写是否可用',
            bg:'#AE81FF',
            time:2
        });
		$("#ENABLE").focus();
		$("#ENABLE").val('');
		$("#ENABLE").css("background-color","white");
		return false;
	}
	 $.ajax({
         type: "POST",
         url: '<%=basePath%>export/addaexport',
         data: $("#shipownerForm").serialize(),
         dataType: 'json',
         cache: false,
         success: function (data) {
        	 alert("保存成功")
        	 window.location.reload();
        	 
         }
     });
}

   //查詢
	function serch() {
		top.jzts();
		$("#shipoener").submit();
	}
	
   //修改
   function edit(ID){
	   top.jzts();
	    var diag = new top.Dialog();
	    diag.Drag = true;
	    diag.Title = "编辑";
	    diag.URL = '<%=basePath%>export/editexport?ID=' + ID;
	    diag.Width = 600;
	    diag.Height = 415;
	    diag.CancelEvent = function () { //关闭事件
	    	diag.close();
	  
	    	window.location.reload();	
	    };
	    diag.show();
	}
	   
 //删除
   function delet(ID){
  	
  	if (confirm("确认要删除本条信息！")){
  		$.ajax({
  			type:"post",
  			url:'<%=basePath%>export/deleteexport?ID='+ID,
  			success:function(){
  				window.location.reload();
  			}
  			
  		})
  		return false;
  		}
  	
  	
  	
  }   
 
	
</script>
</html>